package com.mzy.basics.innerClass;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/1/3 18:37
 * @Version 1.0
 */
//: innerclasses/Parcel5.java
// Nesting a class within a method.

/**
 * 在方法的作用域内（或叫内部），创建了一个完整的类。这被称作局部内部类。
 */
public class Parcel5 {
    public Destination destination(String s) {
        class PDestination implements Destination {
            private String label;
            private PDestination(String whereTo) {
                label = whereTo;
            }
            public String readLabel() { return label; }
        }
        return new PDestination(s);
    }
    public static void main(String[] args) {
        Parcel5 p = new Parcel5();
        Destination d = p.destination("Tasmania");
        System.out.println(d);
    }
} ///:~
